import './assets/main.less'
import 'virtual:svg-icons-register'
import { createApp } from 'vue'
import { createPinia } from 'pinia'
import directive from './directive/index'
import piniaPluginPersistedstate from 'pinia-plugin-persistedstate'
import App from './App.vue'
import router from './router'
import i18n from './lang'

// 引入全局组件
import globalComponent from '@/components/index'

const app = createApp(App)
// 注册自定义指令
directive(app)
// 遍历注册全局组件
for (const componentItem in globalComponent) {
  app.component(componentItem, globalComponent[componentItem])
}
// pinia使用
const pinia = createPinia()
// 使用pinia-plugin-persistedstate插件
pinia.use(piniaPluginPersistedstate)
app.use(pinia)
app.use(router)
app.use(i18n)

app.mount('#app')
